Micron Document
welo git mirrors

Node / public / reticulum / commits / e49f313

Commit e49f31322cfd964b29dd04e36b11568846aa1720


Parents : 95502e2
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Date : 2026-05-14T10:07:03+02:00

Redirect blob to tree page if target is a tree

Changes

1 files changed, 14 insertions(+), 0 deletions(-)


Diff

diff --git a/RNS/Utilities/rngit/pages.py b/RNS/Utilities/rngit/pages.py
index e5eec25d3..a56837025 100644
--- a/RNS/Utilities/rngit/pages.py
+++ b/RNS/Utilities/rngit/pages.py
@@ -689,6 +689,10 @@ class NomadNetworkNode():
if blob_info is None: content_parts.append("File not found at this ref.\n")
else:
+ # Redirect to tree page if this is a tree
+ if blob_info.get("is_tree", None) == True:
+ return self.serve_tree_page(path, data, request_id, link_id, remote_identity, requested_at)
+
size = blob_info.get("size", 0)
is_binary = blob_info.get("is_binary", False)
is_symlink = blob_info.get("is_symlink", False)
@@ -1846,6 +1850,15 @@ class NomadNetworkNode():
size = int(result.stdout.strip())
+ # Check if it's a tree via ls-tree
+ check_tree_path = f"{ref}:{file_path}" if file_path else ref
+ result = subprocess.run(["git", "ls-tree", check_tree_path],
+ cwd=repo_path, capture_output=True, text=True,
+ timeout=self.GIT_COMMAND_TIMEOUT, check=False)
+
+ if result.returncode == 0: is_tree = True
+ else: is_tree = False
+
# Check if it's a symlink via ls-tree
parent_dir = "/".join(file_path.split("/")[:-1])
filename = file_path.split("/")[-1]
@@ -1894,6 +1907,7 @@ class NomadNetworkNode():
if first_line.startswith("-"): is_binary = True
return { "size": size,
+ "is_tree": is_tree,
"is_binary": is_binary,
"is_symlink": is_symlink,
"symlink_target": symlink_target }

Served by rngit 1.4.2 - Generated in 0.02s